{% extends "base_content.html" %}
{% load engine_tags %}

{% block headtitle %}
    Upload Data
{% endblock %}

{% block ribbon %}
    {% include 'widgets/upload_button.html' %}
{% endblock %}

{% block content %}

    <form method="post" class="ui form" enctype="multipart/form-data" action="{% url 'data_upload' project.uid %}">
        {% csrf_token %}

        <div class="ui segment inputcolor">
            {% form_errors form %}

            {{ form.media }}

            <p class="ui header"><i class="ui upload icon"></i>Upload a file</p>

            <p>
                Your storage space is <b>{{ maximum_size|filesizeformat }}</b>.
                Across all projects you use <b>{{ current_size|filesizeformat }}</b>.
            </p>

            <div class="field">
                {{ form.file }}
                <p class="muted">File or zip collection of files you want to analyze.</p>
            </div>

            <button type="submit" class="ui submit green button">
                <i class="write icon"></i>Upload File
            </button>
            <a class="ui right floated button" href="{% url 'data_list' project.uid %}">
                <i class="undo icon"></i>Cancel
            </a>

        </div>

    </form>

    <div class="ui divider">&nbsp;</div>

    <form method="post" class="ui form" enctype="multipart/form-data" action="{% url 'data_upload' project.uid %}">
        {% csrf_token %}

        <div class="ui segment inputcolor">

            <p class="ui header"><i class="edit icon"></i>Direct Data Entry</p>

            <p>You may manually create a dataset here.</p>

            <label>Name</label>
            {{ form.data_name }}
            <p class="muted">Name of the data.</p>

            <label>Input Text</label>
            <textarea rows="10" cols="55" name="{{ form.input_text.name }}" id="id_{{ form.input_text.name }}"
                      maxlength="{{ form.input_text.field.max_length }}">{% if form.input_text.value %}
                {{ form.input_text.value }}{% endif %}</textarea>
            <p class="muted">Enter data as text instead of uploading a file ( {{ form.input_text.field.max_length }}
                characters ).</p>
        </div>

        <button type="submit" class="ui submit green button">
            <i class="write icon"></i>Create Data
        </button>
        <a class="ui right floated button" href="{% url 'data_list' project.uid %}">
            <i class="undo icon"></i>Cancel
        </a>

    </form>

{% endblock %}
